package com.example.demo55.controller;

import com.example.demo55.entity.Inviction;
import com.example.demo55.service.InvictionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
public class HomeController {
    @Autowired
    private InvictionService invictionService;
    @RequestMapping("/show")
    public String show(@RequestParam(value = "title",defaultValue = "") String title, Model model){
        List<Inviction> userList = invictionService.getUserList(title);
        model.addAttribute("title",title);
        model.addAttribute("userList",userList);
        return "index";
    }
}
